<template>
  <view class="money-bg">
    <image src="@/static/h5/money.png"
     style="width: 100%; position: absolute;top: 0;"  mode="widthFix"/>
  </view>
  <view class="money">
    <AddAccount v-if="!aliCode"  :aliCode="aliCode" />
    <Account :dateInfo="dateInfo" :aliCode="aliCode" />
    <AccountInfo :dateInfo="dateInfo" />
    <Behavior />
  </view>
</template>

<script setup lang="ts">
import AddAccount from "./components/AddAccount.vue";
import Account from "./components/Account.vue";
import AccountInfo from "./components/AccountInfo.vue";
import Behavior from "./components/Behavior.vue";
import dyUserPlayingService from "@/api/dyUserPlayingService";
import  type{ IGetUserIncomInfoResponse } from "@/api/model/dyUserCodeModel";
import dyUserInfoService from "@/api/dyUserInfoService";
const dateInfo = ref<IGetUserIncomInfoResponse>()
const userInfo = ref()
const aliCode = computed(()=>{
  return ( userInfo.value && userInfo.value.aliCode) ?  userInfo.value.aliCode : ""
})
const getUserIncomeInfo =async ()=>{
  const {success,result} = await dyUserPlayingService.getUserIncomeInfo()
  if(success){
    dateInfo.value = result
  }
}

const  getUsetInfo = async ()=>{
  const {success,result} = await  dyUserInfoService.getUserInfo()
  if(success){
    userInfo.value = result
  }
}

onLoad(async ()=>{
  uni.showLoading()
  await getUserIncomeInfo()
  await getUsetInfo()
  uni.hideLoading()
})

</script>

<style lang="scss" scoped>
page{
  background: rgb(243,239,254);
}
.money{
    padding: 28rpx;
    position: relative;
}
</style>
